=
href=3D"http://blogs.msdn.com/kcwalina/archive/2005/03/16/39 6787.aspx">ht=
tp://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx
IV>
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"JoeP" <
href=3D"mailto:NoSpam@Hotmail.com">NoSpam@Hotmail.com> wrote =
in message=20
=
href=3D"news:O3FTI3OTIHA.3516@TK2MSFTNGP02.phx.gbl">news:O3F TI3OTIHA.3516=
@TK2MSFTNGP02.phx.gbl...
Hi there,
Here is what I need to do. I =
have an Err=20
handler routine that logs any error either from an
face=3DArial=20
size=3D2>Exception or an SMTPException.
face=3DArial=20
size=3D2>
face=3DArial=20
size=3D2>Within the Catch I call the Handler either for=20
the SMTPException or the Exception. There 2 more =
properties=20
face=3DArial size=3D2>in=20
the SMTPException that I need to log while they do no exists in the=20
Exception.
face=3DArial=20
size=3D2>
face=3DArial=20
size=3D2>In the err handler methods it starts like =
this:
face=3DArial size=3D2>
Public
size=3D2>
color=3D#0000ff size=3D2>Sub
=
ErrorHandler(
color=3D#0000ff size=3D2>ByVal
oErrObject =
color=3D#0000ff size=3D2>As
color=3D#0000ff=20
size=3D2>Object
,
size=3D2>ByVal
cErrorType
color=3D#0000ff=20
size=3D2>As
size=3D2>String
)
size=3D2>End
size=3D2>Sub
So this way Either oibject could be =
picked up and=20
I know which one is which based on the cErrorType,
But I am =
getting a=20
little message saying as follows: =
System.InvalidCastException when=20
I hover on top
of the oErrObject. It works fine=20
otherwise.
The way I call the above =
is:
size=3D2>oInquiery.ErrorHandler(smtpEx,
size=3D2>"SMTPErr")
Or
size=3D2>oInquiery.ErrorHandler(generalEx,
color=3D#800000=20
size=3D2>"GeneralErr"
size=3D2>)
So any =
ideas?=20
size=3D2>
size=3D2>
size=3D2>Thanks,
size=3D2>Joe
size=3D2>
face=3DArial=20
size=3D2>
"Peter Bromberg [C# MVP]" =
<
href=3D"mailto:pbromberg@yahoo.NoSpamMaam.com">
size=3D2>pbromberg@yahoo.NoSpamMaam.com
size=3D2>>=20
wrote in message
=
href=3D"news:BA2B4544-203E-4934-8C6F-7078A09580FE@microsoft. com">
face=3DArial=20
=
size=3D2>news:BA2B4544-203E-4934-8C6F-7078A09580FE@microsoft .com=
A>
face=3DArial size=3D2>...
size=3D2>> You cannot=20
"upcast" a particular base class object to an instance of a more =
>=20
specific object that derives from it. The base class ("Exception") =
has no=20
> idea what the derived object may possibly be. Make =
sense?
>=20
> -- Peter
> Site:
href=3D"http://www.eggheadcafe.com">
size=3D2>http://www.eggheadcafe.com
size=3D2>>=20
UnBlog:
face=3DArial =
size=3D2>http://petesbloggerama.blogspot.com
face=3DArial size=3D2>> MetaFinder:
href=3D"http://www.blogmetafinder.com">
size=3D2>http://www.blogmetafinder.com
size=3D2>=20
>
>
> "JoeP" wrote:
>
>> Hi=20
All,
>>
>> Is that possible to convert an =
Exception=20
object to SMTPException object. I
>> tried CType() and it =
did not=20
work!
>>
>>
>>
>> =
Thanks,
>>=20
>>
>>
>> Joe
>>
>>=20
>>
------=_NextPart_000_0012_01C84D57.4F7E9B50--